home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tpa22.zip / TP&ASM.REF < prev    next >
Text File  |  1989-04-22  |  53KB  |  1,345 lines

  1.  
  2.   TP&Asm           Integrated Compile-Time Assembler          Version 2.0
  3.   TP&Asm-M   Memory Mode Assembly Language Development Tool   Version 2.0
  4.  
  5.                 Copyright (c) 1989  Richard W. Prescott
  6.                           All Rights Reserved
  7.  
  8. ═══════ Built-In Assembly Language Support for Turbo Pascal Compilers ═══════
  9.  
  10.  All brand and product names mentioned herein are trademarks or registered
  11.                 trademarks of their respective holders.
  12.  
  13.   ┌─────────────────────────────────────────────────────────────────────┐
  14.   │ This file contains detailed reference information to enable you to  │
  15.   │ make effective use of the TP&Asm assembly environment.  For general │
  16.   │ information on getting started please see the file README.          │
  17.   └─────────────────────────────────────────────────────────────────────┘
  18.  
  19.  
  20. The following topics are described below:
  21.  
  22.     1. Command Line Options
  23.     2. The Assemble Statement
  24.     3. The Asm Statement
  25.     4. The Internal Statement
  26.     5. General Assembler Syntax
  27.     6. TP&Asm-specific Options
  28.     7. Supported Mnemonics
  29.  
  30.  
  31. The following additional topics are covered in the separate file
  32. TP&ASM2.REF:
  33.  
  34.     8. Error Messages
  35.     9. Trouble Shooting
  36.  
  37.  
  38.  
  39. 1. Command Line Options
  40.  
  41. In the following discussion, "TPA(M)" is used in statements that
  42. apply to both TPA and TPAM.
  43.  
  44. Use TPA if you have the TP&Asm Integrated Compile-Time Assembler,
  45. and TPAM if you have the TP&Asm-M Memory Mode Assembly Development
  46. Tool.
  47.  
  48. TP&Asm is invoked by typing one of the following lines at the DOS
  49. prompt:
  50.      TPA(M) <full command line>
  51.      TPA(M) <abbreviation> <options>
  52.      TPA(M)
  53.  
  54. Full Command Syntax:  At the DOS prompt, type
  55.  
  56.      TPA(M) <full command line>
  57.  
  58. where TPA(M) refers to EITHER TPA or TPAM, and <full command line>
  59. is any valid command line that could be executed directly from the
  60. DOS prompt.  TP&Asm will load into memory and then execute the
  61. command line, exactly as if it had been executed by DOS.  If a
  62. supported Turbo Pascal compiler is loaded at any point during the
  63. execution of the command line, you will see a message indicating
  64. that the assembler is active, and assembly support will be enabled.
  65. TP&Asm will not interfere with the operation of other non-compiler
  66. applications.
  67.  
  68. Examples: (the following examples apply equally well to TPA and
  69.            TPAM)
  70.  
  71.      TPA mybatch
  72.        run the batch file MYBATCH.BAT which changes directories and
  73.        then runs turbo.  Assembly support will be enabled.
  74.  
  75.      TPAM tpc myprog /r"param1 param2"
  76.        run TPC Version 4.0 to compile MYPROG.PAS and run in memory.
  77.        (Please see the Version 4.0 Owner's Handbook for information
  78.        on the /r command line option).  Assembly support will be
  79.        enabled.
  80.  
  81.      TPA command
  82.        load a copy of the command processor and return you to the
  83.        DOS prompt.  You have just made TP&Asm "Memory resident"!
  84.        Now EACH time you run a supported compiler, you will get a
  85.        message indicating that the assembler is active, and
  86.        assembly support will be enabled.  Each time you exit a
  87.        compiler, you will get a message indicating that the
  88.        assembler is inactive.  Type EXIT to quit the command
  89.        processor and remove TP&Asm from memory.  (You should not
  90.        run any RESIDENT programs from the command shell or you will
  91.        not be able to remove it from memory).
  92.  
  93. Abbreviated Syntax:  At the DOS prompt, type one of the following:
  94.  
  95.      TPA(M) c <options>
  96.      TPA(M) d <full command line>
  97.  
  98. TPA(M) c <options> is equivalent to:   TPA(M) tpc <options>,
  99. which runs the command line compiler with the specified options.
  100. Example:
  101.      TPA c myprog         (same as: TPA tpc myprog )
  102. (Please see the Turbo Pascal Owner's Guide for available options).
  103.  
  104. TPA(M) d <full command line> will run any valid DOS command line
  105. through debug with assembly support enabled.  This is primarily of
  106. interest to Turbo Version 4.0 users.  (Requires DEBUG.COM from
  107. your DOS disk).  Examples:
  108.      TPAM d turbo         (same as: TPAM debug turbo.exe )
  109.      TPA d tpc test /r    (same as: TPA debug tpc.exe test /r )
  110.  
  111. NOTE: the recommended method of using any debugger with TP&Asm is to
  112. run the debugger from TP&Asm:
  113.      TPA(M) <debugger> <parameters required by debugger>
  114. (Please be thoroughly familiar with the proper operation of your
  115. debugger before attempting this, since it is definitely possible to
  116. crash your system through improper use of a debugger.  Save your
  117. work frequently, and be prepared to reboot.)
  118.  
  119.  
  120. Quick Command Syntax:  At the DOS prompt, type
  121.  
  122.      TPA(M)
  123.  
  124. where TPA(M) refers to EITHER TPA or TPAM.  TP&Asm will load into
  125. memory and then execute TURBO.EXE, exactly as if you had typed
  126. "turbo" at the DOS prompt.  You will see a message indicating that
  127. the assembler is active, and assembly support will be enabled.
  128. ( This is the same as executing:  TPA(M) TURBO ).
  129.  
  130.  
  131.  
  132.  
  133. 2. The Assemble Statement
  134.  
  135. The syntax for the assemble statement is:
  136.  
  137.     Assemble  <remainder of line must be empty>
  138.  
  139.        <Standard Assembly language statements>
  140.  
  141.     End
  142.  
  143. Use of a semicolon ";" after the final "End" is governed by
  144. standard Pascal statement syntax.  Assembly ends with the first
  145. "End" encountered in the mnemonic field.  The entire line is then
  146. passed on to the compiler, permitting use of an Assemble statement
  147. in either clause of an "IF .. THEN .. ELSE" conditional statement.
  148.  
  149. The keyword "Assembly" is permitted as a synonym for "Assemble".
  150. This is useful to avoid misleading constructions like:
  151.      IF <Pascal Condition> THEN Assemble
  152. which gives the false impression of conditional assembly.  True
  153. conditional assembly is possible using the PAS statement described
  154. in the section TP&Asm-specific options.  Conditional execution of
  155. an assembly block is more clearly indicated by:
  156.      IF <Pascal Condition> THEN Assembly
  157.  
  158. The Assemble statement can be used in any situation where an Inline
  159. statement would be valid, including in the definition of (Assembly)
  160. Inline directive/MACROs.
  161.  
  162. Examples:
  163.  
  164.  {- Conditional execution of assembly code based on runtime value of x: }
  165.   IF x > 0 THEN Assembly
  166.     : <assembly statements>
  167.   End  {without semicolon}  ELSE Assembly
  168.     : <assembly statements>
  169.   End; {requires semicolon}
  170.  
  171.  {- Define an (Assembly) Inline directive/MACRO: }
  172.   PROCEDURE ClearInterrupts;
  173.   Assemble
  174.     Cli
  175.   End; {MACRO ClearInterrupts}
  176.  
  177.  {- Define a callable procedure with assembly code: }
  178.   PROCEDURE PrintScreen;
  179.   BEGIN
  180.     {- Pascal statements may be placed before ... -}
  181.     Assemble
  182.       Int 5
  183.     End; {Assemble}
  184.     {- ... or after the assembly code -}
  185.   END; {PrintScreen}
  186.  
  187.  
  188. Assembly sections may be mixed freely with other Pascal statements
  189. throughout the statement part of a block.  Transfer between Pascal
  190. and assembly sections is freely permitted:
  191.  
  192.  ■ A Pascal label may be specified as the target of any assembly
  193.    Call, Jmp, Loop, or conditional jump.  As with the Pascal "Goto"
  194.    statement, the label must be defined in the current block.
  195.  
  196.  ■ An assembly label may be specified as the target of a Pascal
  197.    "Goto" statement.  The target label must be declared in a
  198.    standard Pascal "Label" statement.  (Assembly labels which are
  199.    referenced only within the current Assemble statement need not
  200.    be declared).
  201.  
  202.  ■ Pascal Procedure and Function identifiers may be specified as
  203.    the target of any assembly Call (or Jmp), or as immediate data
  204.    offsets in assembly data manipulation instructions, eg:
  205.          Mov Dx,PasProc ;load Ofs(PasProc) into Dx
  206.    The Procedure or Function must be defined in the current program
  207.    or in a Unit specified in the Uses clause.  Assembly references
  208.    are fully recognized by the Turbo smart linker.
  209.  
  210.   "System" Procedures and Functions do not use true PROC Calls and
  211.    therefore cannot be called from assembly language, either
  212.    directly or indirectly, except using "PAS" as described below.
  213.  
  214.  ■ The assembly keyword "PAS" may be used to insert single or
  215.    multiple line Pascal statements within